﻿@using NC.Cather
@using NC.Infrastructure.DomainDto
@using NC.Web.Models
@model List<NC.Cather.ContentParams>
@{
    ViewBag.Title = "Index";
}

<section class="content-header">
    <h1>
        文章内容参数管理列表管理
    </h1>
    <ol class="breadcrumb">
        <li><a href="@Url.Action("Details","Person",new {id=Session["personId"]})"><i class="fa fa-dashboard"></i>个人信息</a></li>
    </ol>
</section>
<section class="content">
    <div class="box box-primary">
        <div class="box-header with-border">
            <h3 class="box-title">文章内容参数管理列表信息</h3>
        </div>  

        <div class="box-body no-padding">
            <div class="mailbox-controls">
                <!-- Check all button -->
                <button class="btn btn-default btn-sm checkbox-toggle" id="checkAll"><i class="glyphicon glyphicon-check"></i></button>
                <div class="btn-group">
                    @if (Model.Count < 1)
                    {
                        <a href="@Url.Action("Create")" class="btn btn-default btn-sm"><i class="glyphicon glyphicon-plus"></i></a>
                    }
                    <button class="btn btn-default btn-sm" onclick="deleteData('@Url.Action("Delete")')"><i class="glyphicon glyphicon-trash"></i></button>
                    <button class="btn btn-default btn-sm" onclick="window.location.reload(true);"><i class="glyphicon glyphicon-refresh"></i></button>
                </div>
            </div>
            <div class="table-responsive mailbox-messages">
                <table class="table table-hover table-striped">
                    <thead>
                        <tr>
                            <th></th>

                            <th>
                                容器选择器
                            </th>

                            <th>
                                标题选择器
                            </th>

                            <th>
                                作者选择器
                            </th>

                            <th>
                                出版日期
                            </th>

                            <th>
                                文章详情
                            </th>

                            <th>
                                文章类型选择
                            </th>

                            <th>
                                操作
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in Model)
                        {
                            <tr>
                                <td>
                                    <input type="checkbox" data-id="@item.Id" />
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.ContainerSelector)
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.TitleSelector)
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.AuthorSelector)
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.ComeUpTimeSelector)
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.ContentSelector)
                                </td>

                                <td>
                                    @Html.DisplayFor(modelItem => item.TypeSelector)
                                </td>

                                <td>
                                    <div class="btn-group">
                                        <div class="btn btn-default" onclick="deleteData('@Url.Action("Delete")','@item.Id')"><i class="glyphicon glyphicon-trash"></i></div>
                                        <a class="btn btn-default" href="@Url.Action("Edit", new { id=item.Id})"><i class="glyphicon glyphicon-edit"></i></a>
                                    </div>
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</section>
<script src="~/Content/Assert/Js/Common.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $("#search").keydown(function (e) {
            if (e.keyCode == 13) {
                search();
            }
        });
        //初始化时间选择器
        $("#startTime").datetimepicker();
        $("#endTime").datetimepicker();
    });


    function search() {
        var startTime = $("#startTime").val();
        var endTime = $("#endTime").val();
        var search = $("#search").val();
        var url = setUrlValue("startTime", startTime);
        url = setUrlValue("endTime", endTime, url);
        url = setUrlValue("search", search, url);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function containerSelectorChange() {
        var containerSelector = $("#containerSelector").val();
        var url = setUrlValue("containerSelector", containerSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function titleSelectorChange() {
        var titleSelector = $("#titleSelector").val();
        var url = setUrlValue("titleSelector", titleSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function authorSelectorChange() {
        var authorSelector = $("#authorSelector").val();
        var url = setUrlValue("authorSelector", authorSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function comeUpTimeSelectorChange() {
        var comeUpTimeSelector = $("#comeUpTimeSelector").val();
        var url = setUrlValue("comeUpTimeSelector", comeUpTimeSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function contentSelectorChange() {
        var contentSelector = $("#contentSelector").val();
        var url = setUrlValue("contentSelector", contentSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

    function typeSelectorChange() {
        var typeSelector = $("#typeSelector").val();
        var url = setUrlValue("typeSelector", typeSelector);
        window.location.href = "@Url.Action("Index")" + url;
    }

</script>


